<template>
  <view class="shoplist">
    <view
      class="list-item"
      v-for="item in wareList"
      :key="item.id"
      @click="goProduct(item)"
    >
      <view class="list-item-left">
        <img :src="item.waresPic" alt="" srcset="" />
      </view>
      <view class="list-item-right">
        <view class="item-right-top">
          <span class="info">
            {{ item.waresName }}
          </span>
          {{ item.waresDetail }}
        </view>
        <view class="item-right-bottom">
          <span class="price"><span class="icon"></span>{{ item.saleIntegral }}</span>
          <span class="sold">{{ "库存 " + item.waresCount }}</span>
        </view>
      </view>
    </view>
    <view class="none_list">没有更多了~</view>
  </view>
</template>

<script>
import { mapState, mapActions } from "vuex";

export default {
  data() {
    return {
      wareList: [],
    };
  },
  props: ['sid'],
  created() {
    if(!!this.sid){
      this.onLoadMethod();
    }
  },
  computed: {

  },
  watch: {
    // 如果 `question` 发生改变，这个函数就会运行
    sid:function(){
      this.onLoadMethod();
    }
  },
  methods: {
    async onLoadMethod() {
      try {
        const res = await this.$Request({
          url: "/getIntegralWaresInfoList",
          method: "GET",
          data: {
            stationId: this.sid,
          }
        });

        if (res.retCode === 0) {
          this.wareList = res.data
        }
      } catch (error) {
      }
    },

    goProduct(item){
      uni.navigateTo({
        url: `/subPackB/point/detail/_sid/_pid?sid=${this.sid}&id=${item.id}`
      })
    }
 
  },
};
</script>

<style scope>
.shoplist {
  width: 92vw;
}

.shoplist .list-item {
  display: flex;
  margin-top: 30px;
  width: 92vw;
  height: 28.5vw;
}
.shoplist .list-item .list-item-left {
  width: 28.5vw;
  height: 28.5vw;
  border: 0.26vw solid #eeeeee;
  flex-shrink: 0;
}
.shoplist .list-item .list-item-left img {
  display: inline-block;
  width: 100%;
  height: 100%;
  border-radius: 3vw;
}
.shoplist .list-item .list-item-right {
  margin-left: 3vw;
  width: 60.5vw;
  color: red;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  font-size: 4.266vw;
  font-weight: 400;
  color: #111111;
  line-height: 6vw;
  height: 28.5vw;
}
.shoplist .list-item .list-item-right .item-right-top {
  flex-shrink: 0;
  word-break: break-all;
  width: 453rpx;
  height: 145rpx;
  font-size: 32rpx;
  font-family: PingFangSC-Regular, PingFang SC;
  font-weight: 400;
  color: #111111;
  line-height: 45rpx;
}

.shoplist .list-item .list-item-right .item-right-top .info {
  font-weight: 500;
}

.shoplist .list-item .list-item-right .item-right-bottom {
  width: 453rpx;
  height: 90rpx;
  position: relative;
}
.shoplist .list-item .list-item-right .item-right-bottom .price {
  font-size: 40rpx;
  font-family: PingFangSC-Medium, PingFang SC;
  font-weight: 500;
  color: #fe9700;
  line-height: 56rpx;
  position: absolute;
  left: 10rpx;
  bottom: 0;
}
.shoplist .list-item .list-item-right .item-right-bottom .price .icon {
  display: inline-block;
  width: 30rpx;
  height: 30rpx;
  background: url("../../subPackB/static/point/a01_jifen@2x.png") no-repeat;
  background-size: cover;
  margin-right: 10rpx;
}
.shoplist .list-item .list-item-right .item-right-bottom .sold {
  height: 40rpx;
  font-size: 28rpx;
  font-family: PingFangSC-Regular, PingFang SC;
  font-weight: 400;
  color: #bcbcbc;
  line-height: 40rpx;
  position: absolute;
  right: 10rpx;
  bottom: 3rpx;
}
.none_list {
  width: 100%;
  text-align: center;
  color: #999;
  font-size: 24rpx;
  margin-top: 30rpx;
}
</style>
